package java44th.group.controller.wx.topic;

import java44th.group.bean.admin.vo.BaseRespVo;
import java44th.group.bean.common.BasePageInfo;
import java44th.group.bean.common.CommonData;
import java44th.group.bean.po.MarketTopic;
import java44th.group.bean.wx.vo.topic.DetailVo;
import java44th.group.bean.wx.vo.topic.ListVo;
import java44th.group.bean.wx.vo.topic.RelatedTopicVo;
import java44th.group.service.wx.topic.WxTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ProjectName project-second
 * @Descriptiom TODO
 * @Aurhor: 蔡文强
 * @Since: 2022/10/15 10:33
 */
@RestController
@RequestMapping("wx/topic")
public class WxTopicController {

    @Autowired
    WxTopicService wxTopicService;

    @RequestMapping(value = "list",method = RequestMethod.GET)
    public BaseRespVo list(BasePageInfo basePageInfo){

        CommonData<ListVo> listVoCommonData = wxTopicService.queryTopicList(basePageInfo);

        return BaseRespVo.ok(listVoCommonData);
    }

    @RequestMapping(value = "detail",method = RequestMethod.GET)
    public BaseRespVo detail(Integer id){

        DetailVo detailVo = wxTopicService.queryTopicInfoById(id);

        return BaseRespVo.ok(detailVo);
    }

    @RequestMapping(value = "related",method = RequestMethod.GET)
    public BaseRespVo related(Integer id){

        //CommonData<MarketTopic> relatedMarketTopicCommonData = wxTopicService.queryRelatedTopic(id);

        //return BaseRespVo.ok(relatedMarketTopicCommonData);

        RelatedTopicVo relatedMarketTopic = wxTopicService.queryRelatedTopic2(id);
        return BaseRespVo.ok(relatedMarketTopic);
    }

}
